﻿/*
 * 2022/12/14 how to use automapper
 * 1、nuget install
     > install-package AutoMapper;
 * 
 * 2、add config file
     AutoMapperConfig.cs  (the file)
 * 
 * 3、regist config file in program.cs file
    AutoMapper.IConfigurationProvider mapConfig = new MapperConfiguration(x => {
        x.AddProfile<AutoMapperConfig>();
    });
    builder.Services.AddSingleton(mapConfig);
    builder.Services.AddScoped<IMapper,Mapper>();
 * 
 * 4、how to use
    IMapper _map;
    public BaseService( IMapper map)
    {
        _map = map;
    }

    //....
    
    //in method
     _map.Map<TSource, TD>(t); 
 *    
 * **/
using AutoMapper;
using Max.PH5_2006.ShoppingSite.Domain;
using Max.PH5_2006.ShoppingSite.DTO;

namespace Max.PH5_2006.ShoppingSite.API.MyConfig
{
    public class AutoMapperConfig : Profile
    {
        public AutoMapperConfig()
        {
            CreateMap<MemberInputDto, MemberEntity>();
            CreateMap<MemberEntity, MemberOutputDto>();

            CreateMap<CityEntity, CityEntity>();
        }
    }
}
